package com.ecoolex.ying.space.enums;

import com.ecoolex.framework.common.EnumInterface;
import com.ecoolex.framework.common.util.Check;
import com.ecoolex.ying.space.entity.PickGoods;

public enum PickGoodsStatus implements EnumInterface<PickGoodsStatus, Integer> {
	OFFLINE(0, "离线"),
	ONLINE(1, "上线");

	private int real;

	private String describe;

	private PickGoodsStatus(int real, String describe) {
		this.real = real;
		this.describe = describe;
	}

	@Override
	public Integer real() {
		return real;
	}

	@Override
	public String describe() {
		return describe;
	}

	@Override
	public PickGoodsStatus realOf(Integer real) {
		if (Check.notNull(real)) {
			for (PickGoodsStatus v : values()) {
				if (v.real().equals(real)) {
					return v;
				}
			}
		}
		return null;
	}

	public static boolean canDel(PickGoods goods) {
		return OFFLINE.equal(goods.getStatus());
	}

	public static boolean canOnline(PickGoods goods) {
		return OFFLINE.equal(goods.getStatus());
	}

	public static boolean canOffline(PickGoods goods) {
		return ONLINE.equal(goods.getStatus());
	}
}
